package org.example.redirect.console;

import org.example.redirect.console.common.Util;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.ApplicationContextEvent;

@SpringBootApplication
public class App implements ApplicationListener<ApplicationContextEvent> {
    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }

//    @Bean
//    public ExitCodeGenerator exitCodeGenerator(){
//        return () -> {
//            System.out.println("getExitCode");
//            return 0;
//        };
//    }

    @Override
    public void onApplicationEvent(ApplicationContextEvent event) {
        Util.context=event.getApplicationContext();
    }
}
